package com.test;

import com.common.User;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author lxl
 * @date 2020/12/26 - 10:17
 */
public class MyServer {
    public static void main(String[] args) {
            new MyServer();
    }
    public MyServer() {
        try{
            System.out.println("在3456端口监听");
            ServerSocket ss= new ServerSocket(3456);
            Socket s = ss.accept();
            ObjectInputStream ois= new ObjectInputStream(s.getInputStream());
            User u =(User) ois.readObject();
            System.out.println("从客户端接收到了以下信息");
            System.out.println(u.getName());
            System.out.println(u.getPwd());
        }catch (Exception e){

        }
    }
}
